package com.ebupt.migu.music.schedule.util;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

/**
 * @author xuhongsong@cd.ebupt.com
 * @version 1.0
 * @className ReadUtils
 * @date 2020/7/3 10:36
 */
public class ReadUtils {

    /**
     *  根据文件将获取到的内容转化为List
     * @param path
     * @return List<String>
     */
    public static List<String> getFileContext(String path){
        FileReader fileReader;
        List<String> list;
        BufferedReader bufferedReader;
        try {
            fileReader =new FileReader(path);
            bufferedReader =new BufferedReader(fileReader);
            String str=null;
            list=new ArrayList<String>();
            while((str=bufferedReader.readLine())!=null) {
                if(str.trim().length()>2) {
                    list.add(str);
                }
            }
            return list;
        }catch (IOException e){
            e.printStackTrace();
        }
        return null;
    }





}
